package com.xiaomi.service.impl;

import com.xiaomi.entity.User;
import com.xiaomi.mapper.UserMapper;
import com.xiaomi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ClassName UserServiceImpl
 * @Description TODO
 * @Author lll
 * @Date 2021/11/27 14:35
 * @Version 1.0
 **/
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> pageSearch(Integer startRow, Integer limit, Integer id, String name) {
        return userMapper.pageSearch(startRow, limit, id, name);
    }

    @Override
    public Integer getCount(Integer id, String name) {
        return userMapper.getCount(id, name);
    }

    @Override
    @Transactional
    public Integer insert(String zhanghao, String name, String phone, String userpwd,  Integer dizhiId, Integer carId) {
        return userMapper.insert(zhanghao, name, phone, userpwd, dizhiId, carId);
    }

    @Override
    public Integer update(String zhanghao, String name, String phone, String userpwd, Integer dizhiId, Integer carId, Integer id) {
        return userMapper.update(zhanghao, name, phone, userpwd, dizhiId, carId, id);
    }

    @Override
    public Integer delete(Integer id) {
        return userMapper.delete(id);
    }
}
